package sapling.logic.object.pcb;

import sapling.logic.object.pcb.attr.Priority;
import sapling.util.MyStrings;

public class ProcessControlBlock {

	private static int ID = 0;

	private Identification id;
	private Description desc;
	private SceneInfo sceneInfo;
	private Management management;

	public ProcessControlBlock(String tag, int priority, int liveLong) {
		this.id = new Identification(ID++, tag);
		this.desc = new Description();
		this.sceneInfo = new SceneInfo();
		this.management = new Management(priority, liveLong);
	}

	public int getPriority() {
		return this.management.getPriority();
	}

	public int getInitPriority() {
		return this.management.getInitPriority();
	}

	public void setPriority(int priority) {
		this.management.setPriority(priority);
	}

	public int getLiveLong() {
		return this.management.getLiveLong();
	}

	public void setLiveLong(int liveLong) {
		this.management.setLiveLong(liveLong);
	}

	public int getInitLiveLong() {
		return this.management.getInitLiveLong();
	}

	public int getTimes() {
		return this.management.getTimes();
	}

	public void setTimes(int times) {
		this.management.setTimes(times);
	}

	public SceneInfo getSceneInfo() {
		return sceneInfo;
	}

	public String getTag() {
		return this.id.getTag();
	}

	public int getId() {
		return this.id.getId();
	}

	public void release() {

	}

	public static void initID() {
		ID = 0;
	}

	public String toString() {
		return this == null ? ""
				: "Tag:" + this.getTag() + "\tPID:" + this.getId() + "\tLife:" + this.getLiveLong() + "\tPriority:"
						+ MyStrings.PRIORITY_STR[this.getPriority()];
	}

}
